----------------
--- Consoles ---
----------------

Open the Consoles.json file in the /Files/Games directory.
Each game consists of attributes in the JSON format.
Make sure to assign a console mode for every new game.

Attributes lines that are not present are equivalent to 0 or just empty.



--- Lines ---
title				Console title as shown in the Patcher64+ Tool GUI.

mode				Console mode which is used to link a game with, also used to read code with.

extension			String value for the file extension the rom uses (example: ".z64")

rom_title			If the Console supports a ROM title in native mode so it can be changed.
				0		ROM title is not supported in native mode
				1		ROM title is supported in native mode

rom_title_length		Decimal value for how long the game title may be in the ROM.

rom_title_offset		Hexadecimal value for where the game title can be found in the ROM.

rom_title_offset_2		Alternative hexadecimal value for where the game title can be found in the ROM.

rom_title_uppercase		If the ROM title should be forced in uppercase.
				0		Uppercase for the ROM title is not forced
				1		Uppercase for the ROM title is forced

rom_gameID			If the console supports a ROM GameID in native mode so it can be changed.
				0		ROM GameID and Region Code are not supported in native mode
				1		ROM GameID is supported in native mode
				2		ROM Region Code is supported in native mode

rom_gameID_offset		Hexadecimal value for where the GameID can be found in the ROM.

remove_region_protection	If the console supports the removal of the region protection.
				0		Region Protection removal is not supported
				1		Region Protection removal is supported

max_size			Decimal value for the maximum size the ROM can be (measured in MB)

appfile				The AppFile which should contain the ROM in the Virtual Console's WAD file.
				"00000001.app"	Used for NES ROMs, this is the VC emulator itself
				"00000005.app"	Used for SNES/N64 ROMs, which is a container for the ROM and T64 files

t64				If console contains T64 textures.
				0		Disable the "Remove All T64" checkbox
				1		Allow the "Remove All T64" checkbox

expand_memory			If console supports expanding the Expansion Pak (larger RAM memory).
				0		Disable the "Expand Memory" checkbox
				1		Allow the "Expand Memory" checkbox

remove_filter			If console supports removing the dark filter overlay.
				0		Disable the "Remove Filter" checkbox
				1		Allow the "Remove Filter" checkbox



--- Example Console ---
"title"				: "Nintendo 64",
"mode"				: "N64",
"extension"			: ".z64",
"rom_title"			: 1,
"rom_title_length"		: 20,
"rom_title_offset"		: "20",
"rom_title_uppercase"		: 1,
"rom_gameID"			: 1,
"rom_gameID_offset"		: "3B",
"max_size"			: "64",
"appfile"			: "00000005.app",
"t64"				: 1,
"expand_memory"			: 1,
"remove_filter"			: 1



-------------
--- Games ---
-------------

Open the Games.json file in the /Files/Games directory.
Each game consists of attributes in the JSON format. The main object is "game".
When adding a new entry, make sure to add a new folder in Files with the same name as the "mode" attribute.
Each game folder should contain an icon (Icon.ico), credits (Credits.txt), information (Info.txt) and a set of patches (Patches.json).
Patches can be added Patches.json file.
LZSS (de)compression for the "00000001.app" is auto-detected.

Attributes lines that are not present are equivalent to 0 or just empty.



--- Lines ---
title		Game title as shown in the Patcher64+ Tool GUI.

mode		Game mode as shown in the Active Mode label, also used to read code with.

save		If the game supports saving it's individual settings.
		0		Save settings to ini file is not enabled
		1		Save settings to ini file is enabled


support_vc	If the game supports the Virtual Console.
		0		Game is not available in Wii VC mode
		1		Game is available in Wii VC mode

console		In which console mode the game is accessible, accepted values are defined the Consoles.json file.

version		If the ROM has multiple versions (revisions, regions)
		The following sub-attributes can be assigned to "version"
		"file"		Downgrade patch file path, supports Decompression and Extension
		"rom_gameID"	String value for a new ROM GameID to force
		"hash"		ROM Hash checksum to apply the downgrade patch on
		"rev"		Revision title to show
		"region"	Region for the ROM version to show
		"supported"	If the version is supported (1) or not (0)

romc		Type of ROM in the VC WAD File.
		0		Regular uncompressed ROM
		1		Super Smash Bros. / The Legend of Zelda: Majora's Mask compressed ROMC
		2		Paper Mario compressed ROMC

patches		If the Patch Options panel is shown.
		0		Hide Patch Options panel
		1		Show Patch Options panel

decompress	If the ROM is capable of decompressing.
		0		ROM can not decompress
		1		ROM can decompress (Zelda 64 only)
		2		ROM can decompress (Super Mario 64 only)

dmaTable	New dmatable to overwrite existing dmatable with.

rom_title	Default game title for the ROM, no more than the amount of characters defined for the console.

rom_gameID	Default GameID for the ROM, requires 4 characters (N64 only).

rom_region	Default Region Code for the ROM, requires hexadecimal value between 0 and 20 (SNES only).

vc_title	Default channel title for the Wii VC WAD, no more than 40 characters.

vc_gameID	Default GameID for Wii VC WAD, requires 4 character.

default_values	Set default values for several patching options, which is useful when multiple games share similar components with with different values

mq_files	Decimal value with the amount of Master Quest dungeon files to check for validation.

checksum	If ROM checksum validation should be run prior to patching.
		0		Disable ROM checksum validation
		1		Enable ROM checksum validation



--- Example Game ---
"title"			: "The Legend of Zelda: A Link to the Past",
"mode"			: "A Link to the Past",
"save"			: 1,
"support_vc"		: 1,
"console"		: "SNES",
"version" : [ {
	"hash"		: "3F4D2B3C92B6308BEB1AF2CE15C29DEB",
	"rev"		: "Revision 0",
	"region"	: "North America / NTSC-U"
} ],
"patches"		: 1,
"rom_title"		: "THE LEGEND OF ZELDA",
"rom_region"		: 1,
"vc_title"		: "The Legend of Zelda",
"vc_gameID"		: "JADE"



---------------
--- Patches ---
---------------

Open the Patches.json file in one of the game folders in /Files/Games.
Each patch consists of attributes in the JSON format.

Currently each game folder has four sub-directories: AppFile01, Binaries (hardcoded), Compressed, Decompressed, Downgrade, Export (hardcoded) and Textures (hardcoded).
A few patches in Compressed and Decompressed are hardcoded.

Attributes lines that are not present are equivalent to 0 or just empty.



--- Lines ---
title		Patch title as shown in the Patcher64+ GUI.

console		In which console mode the patch is accessible, accepted values are: "Native", "Wii VC" or "Both"

command		Special command for patches. Commands can be mixed. Uppercase or lowercase does not matter.
		""			Empty, no command given
		"Force Downgrade"	Downgrade the ROM to Rev 0
		"No Downgrade"		Prevent downgrading the ROM to a Rev 0 ROM File
		"Force Remap D-Pad"	Remap the D-Pad for the ROM
		"No Remap D-Pad"	Prevent remapping the D-Pad for the ROM
		"Patch Boot DOL" 	Patch the Boot DOL File in the VC WAD (uses the patch file name for the Boot DOL patch)
		"Extract"		Extract .Z64 ROM from Wii VC .WAD only
		"Inject"		Inject .Z64 ROM into Wii VC .WAD File
		"Patch VC"		Patch Wii VC .WAD File with "Patch VC Options" only
		"Apply Patch"		Apply custom provided .bps, .ips, .xdelta or .vcdiff patch file
		
redux		If the patch supports Redux. Redux is only supported by OoT and MM.
		The following sub-attributes can be assigned to "redux" as well. These attributes overwrite the regular attributes
		"options"		If Redux supports additional options
		"remap_controls"	If the "Remap Controls" option is forced (1), not forced (-1) or using user settings (0)
		"expand_memory"		If the "Expand Memory" option is forced (1), not forced (-1) or using user settings (0)
		"dmaTable"		New Redux specific dmatable to overwrite existing dmatable with
		"rom_title"		ROM game title, no more than the amount of characters defined for the console
		"rom_gameID"		ROM GameID, requires 4 characters
		"vc_title"		Wii VC WAD channel title, no more than 40 characters
		"vc_gameID"		Wii VC WAD GameID, requires 4 characters
		"file"			Patch file path, supports Decompression and Extension
		"file_widescreen"	Alternate patch file patch (for widescreen modified versions)
		"output"		Output file name extension

options		If the patch supports additional options.
		0			Disable "Options"
		1			Show "Options" and allow it if the checkbox is checked

dmaTable	New dmatable specificially for this patch to overwrite existing dmatable with

remap_controls	If the "Remap Controls" option should be forced or not
		-1			"Remap D-Pad" is forced to be not used
		 0			"Remap D-Pad" can be set freely
		 1			"Remap D-Pad" is forced to be used

expand_memory	If the "Expand Memory" option should be forced or not
		-1			"Expand Memory" is forced to be not used
		 0			"Expand Memory" can be set freely
		 1			"Expand Memory" is forced to be used

rom_title	ROM game title for the patch, No more than 20 characters.

rom_gameID	ROM GameID for the patch, requires 4 characters.

rom_region	ROM region code for the patch, requires value between 0 and 20 (SNES only)

vc_title	Wii VC WAD Channel Title for the patch, no more than 40 characters.

vc_gameID	Wii VC WAD GameID for the patch, requires 4 characters.

file		Patch file. Start with \\. Patch is located in current same folder, but can be set into folders.
		Add \\Decompressed for decompressed patches. Provide patches in .bps, .ips, .xdelta or .vcdiff
	 	Flips is be used by default (.bps / .ips). Xdelta (.xdelta) or Xdelta3 (.vcdiff) will be automaticially recognized.

patch		If the patch is supported for multiple revisions it can be assigned here with multiple entries.
		"file"			The patch file to apply, using specifications set by the file parameter.
		"hash"			The MD5 checksum hash value to which the patch file should be applied for.

extend		Specify the new size for the extended ROM. Only works for SM64. Is required for decompressed patches.
		Size value must be between 18 and 64. Will only be used for decompressed patches.

output		Output file name extension.

hash		Hashsum check on N64 rom. Hashes are in MD5.
		"Dawn & Dusk" is a special hash command that allows all three N64 US OoT revisions.

tooltip		Patch button description.



--- Example Patch ---
"title"				: "Ocarina of Time",
"redux" : {
	"options"		: 1,
	"remap_controls"	: 1,
	"expand_memory"		: 1,
	"vc_title"		: "Redux: Ocarina",
	"vc_gameID"		: "NAC0",
	"file"			: "Decompressed\\redux.bps",
	"output"		: "_redux_patched"
},
"options"			: 1,
"tooltip"			: "The regular Ocarina of Time experience{0}With support for languages, redux and additional options{0}- Supported: Rev 0 (US)"



-----------------
--- Languages ---
-----------------

Each game can contain it's own Language.json file within the Languages folder (which is in the game folder in /Files/Games).
Each patch consists of attributes in the JSON format.

Attributes lines that are not present are equivalent to 0 or just empty.

title			Button with title for the language that displays.

code			Regional code value used for location patching files. The language patch itself should be within the Languages folder and contain the same file name as the regional code.

region			A single character value used for changing the region code part of the GameID. Useful when a ROM can switch between regions through changing it's GameID value.

rom_title		ROM game title, no more than the amount of characters defined for the console.

rom_gameID		ROM GameID, requires 4 characters.

vc_title		Wii VC WAD channel title, no more than 40 characters.

vc_gameID		Wii VC WAD GameID, requires 4 characters.

file			Patch file path, supports Decompression and Extension.

script_start		Start of the script file in ROM, useful for OoT / MM and is required for script edit options.

script_length		Length of the script file in ROM, useful for OoT / MM and is required for script edit options.

l_target		International L Targeting menu option texture file to replace for OoT / MM.

l_target_jpn		If language patch uses the L Targeting menu option in the Japanese section of the OoT ROM.
			0	English section is used for the texture
			1	Japanese section is used for the texture

l_target_search		Z Targeting dialogue to search for replacing, useful for OoT / MM.

l_target_replace	L Targeting dialogue to replace, useful for OoT / MM.

tatl			"Tatl" texture file to replace for MM.

tatl_search		"Tatl" dialogue to search for replacing, useful for MM.

tatl_replace		"Tatl" dialogue to replace, useful for MM.

max_text_speed		Allow the max text speed for a language, can be set to 1, 2 or 3.

output			Output file name extension.



--- Example Patch ---
"title"			: "German",
"code"			: "de",
"vc_title"		: "Zelda: Ocarina (de)",
"vc_gameID"		: "NACD",
"script_start"		: "348E070",
"script_length"		: "3B9C0",
"max_text_speed"	: 2,
"output"		: "_de_patched",
"credits"		: "Admentus, GhostlyDark & Ticamus (ported)"



-----------------
--- Controls ---
-----------------

Each game can contain it's own Controls.json file within the game folder folder in /Files/Games).
Each patch consists of attributes in the JSON format.

Attributes lines that are not present are equivalent to 0 or just empty.

offsets		The offset for each button to patch in the Virtual Console's "00000001.app" file.
		Each button can have it's own entry with the offset in hexadecimal.
		Supported buttons are set by their GameMode.
		N64: 		A, B, L, R, Z, Start, D-Pad buttons, C-Buttons
		SNES:		A, B, X, Y, Start, Select				(Not supported yet)
		NES:		A, B, Start, Select					(Not supported yet)

presets		All the presets for controls a game mode includes. Supports multiple entries.
		Each button can have it's own entry with the new button remap as a string.
		Supported buttons are set by their GameMode.
		N64: 		A, B, L, R, Z, Start, D-Pad buttons, C-Buttons
		SNES:		A, B, X, Y, Start, Select				(Not supported yet)
		NES:		A, B, Start, Select					(Not supported yet)
		"title"		The title for the preset to display



--- Example Patch ---
"offsets" : {
	"a"		: "150F00",
	"b"		: "150F04",
	"x"		: "150F08",
	"y"		: "150F0C",
	"l"		: "150F10",
	"r"		: "150F14",
	"z"		: "150F18",
	"start"		: "150F1C",
	"dpadup"	: "150F34",
	"dpaddown"	: "150F38",
	"dpadright"	: "150F3C",
	"dpadleft"	: "150F40",
	"cup"		: "150F44",
	"cdown"		: "150F48",
	"cleft"		: "150F4C",
	"cright"	: "150F50"
},
"presets" : [ {
	"title"		: "Vanilla",
	"a"		: "A",
	"b"		: "B",
	"x"		: "C-Down",
	"y"		: "C-Right",
	"l"		: "Z",
	"r"		: "Z",
	"z"		: "R",
	"start"		: "Start",
	"dpadup"	: "L",
	"dpaddown"	: "L",
	"dpadleft"	: "L",
	"dpadright"	: "L",
	"cup"		: "C-Up",
	"cdown"		: "C-Down",
	"cleft"		: "C-Left",
	"cright"	: "C-Right"
} ]



---------------
--- Models ---
---------------

Each game can contain it's own Models.json file within the Models folder (which is in the game folder in /Files/Games).
Each patch consists of attributes in the JSON format.

Attributes lines that are not present are equivalent to 0 or just empty.

name			Name for the Child and Adult model to be shown as

child_author		Name of the author of the Child model

child_porter		Name of the porter of the Child model

child_url		String value of an URL link to visit when clicked on the Child model preview image

child_wip		If the Child model should be labeled as Work-In-Progress
			0	Child model is final
			1	Child model is Work-In-Progress
			2	Child model is a demonstration of the final version

adult_author		Name of the author of the Adult model

adult_porter		Name of the author of the Adult model

adult_url		String value of an URL link to visit when clicked on the Adult model preview image

adult_wip		If the Adult model should be labeled as Work-In-Progress
			0	Adult model is final
			1	Adult model is Work-In-Progress
			2	Adult model is a demonstration of the final version

deku_shield		If Deku Shield changes and replacements are supported
			0	Deku Shield changes and replacements are not supported (indestructible Deku Shield can still be supported)
			1	Deku Shield changes and replacements are supported

mirror_shield		If Mirror Shield changes and replacements are supported
			0	Mirror Shield changes and replacements are not supported
			1	Mirror Shield changes and replacements are supported



--- Example Patch ---

"name"		: "Majora's Mask",
"child_author"	: "Nintendo",
"child_porter"	: "The3DDude",
"adult_author"	: "Skilarbabcock",
"adult_url"	: "https://www.youtube.com/user/skilarbabcock"



--------------------------------
--- PowerShell Script Module ---
--------------------------------

In order to create a new GUI for a game defined in the Games.json file a new PowerShell Script Module (.psm1) has to be created.
The new .psm1 file should be placed in \Files\Scripts\Options with any file name you like.

Each module automaticially recognizes the following functions:
- PatchOptions (for file-patching regular options)
- PatchRedux (for file-patching Redux related options)
- ByteOptions (for byte-patching regular options)
- ByteRedux (for byte-patching Redux related options)
- ByteLanguage (for byte-patching language related options)
- CreateOptions (initial function to call the GUI)

Each of these functions need their function name extended by the "mode" value of the game without any spaces or special symbols in it, so for example:
- PatchOptionsMajorasMask

The GUI can be divided into tabs by calling the CreateOptionsDialog with the -Tabs attribute.
Ex. -Tabs @("Audiovisual", "Difficulty", "Colors", "Equipment", "Cutscenes")
This adds the tabs as defined above.
The tab "Redux" is automaticially defined if there is a Redux patch.
The tab "Language" is automaticially defined if there are Language patches available. Call the funcrion CreateLanguageContent to add the available languages.
The tab "Main" is automaticially added when more than more tab is defined.

A tab can be initalized by calling the function in the following manner "CreateTab" + TabName + GameMode. An example is listed below.
- CreateTabAudiovisualOcarinaOfTime

File-patching functions should be used for options that are applied through a patch file such as BPS or IPS.
Byte-patching functions should be used for options that are applied directly by loading in the whole ROM in the RAM, alter individual changes and then resave the ROM.

Existing modules can be looked at as an example.

Other than using the reserved functions to get started, just about everything can be manually coded as you like.
Make sure to export all used functions, including the reserved functions.
Reserved functions are not required to be used.